/*	This file is part of LSAC.

	LSAC is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	LSAC is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with LSAC.  If not, see <http://www.gnu.org/licenses/>.

	Copyright (c) 2010 LEPESME "Jiboo" Jean-Baptiste
*/

#include "cExpGreaterEqual.h"
#include "lsac.h"

cExpGreaterEqual::cExpGreaterEqual(cLocation pLocation, cExpression *pLValue, cExpression *pRValue)
	: cExpBinary(pLocation, pLValue, pRValue)
{
}

cExpGreaterEqual::~cExpGreaterEqual()
{
}

void cExpGreaterEqual::print(int pLevel)
{
	PRINT_LOG("cExpGreaterEqual " << this);
	this->print_value(pLevel);
}

eType cExpGreaterEqual::getType(cSemContext *pContext)
{
	return TYPE_BOOL;
}

void cExpGreaterEqual::validate(cSemContext *pContext)
{
	if(this->dLValue->getType(pContext) != TYPE_INT || this->dRValue->getType(pContext) != TYPE_INT)
	{
		ERROR("Erreur en " << this->dLocation << " une comparaison n' est possible qu' entre 2 entiers.");
	}
}

void cExpGreaterEqual::genCode(ostream &pStream)
{
	this->dLValue->genCode(pStream);
	pStream << " >= ";
	this->dRValue->genCode(pStream);}
